{extend name='common/_container'}
{block name="content"}
<link rel='stylesheet' href='__PUBLIC__/static/css/profile/demo.css'>
<link rel='stylesheet' href='__PUBLIC__/static/css/profile/addProfile.css'>
<div class="ibox float-e-margins">
	<input type="hidden" name='id' id='id' value="{$info.id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row" style="margin-top:-20px;">
				<div class="layui-tab layui-tab-brief" lay-filter="test">
					<ul class="layui-tab-title">
						<li class="layui-this" lay-id="1">客户信息</li>
						<li lay-id="2">护照信息</li>
					</ul>
					<div class="layui-tab-content" style="margin-top:10px;">
						<div class="layui-tab-item layui-show">
							<div class="col-sm-12 layui-form">
								<div class="row" style="margin-top:20px;">
									<div class="form-group">
										<label class="col-sm-2 control-label">客户编号：</label>
										<div class="col-sm-9">
											<input type="text" id="name" value="{$info.id}" readonly="readonly" name="mobile" class="form-control">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">翻译：</label>
										<div class="col-sm-9">
											<select lay-ignore name="translater_id" class="form-control" id="translater_id">
												<option value="">请选择</option>
												{sql query="select name,id from cd_translator where id >0"}
												{if condition="$info.translater_id>0"}
												<option value="{$sql.id}" {if condition="$info.translater_id eq $sql.id" }selected{/if}>{$sql.name}</option>
												{/if}
												{if condition="$info.translater_id==0" }
												<option value="{$sql.id}" >{$sql.name} </option>
												{/if}
												{/sql}

												</option>
											</select>
										</div>
										<label class="col-sm-2 control-label">承办人：</label>
										<div class="col-sm-9">
											<select lay-ignore name="director_id" class="form-control" id="director_id">
												<option value="">请选择</option>
												{sql query="select name,user_id from cd_user where group_id >0"}
												{if condition="$info.director_id>0"}
												<option value="{$sql.user_id}" {if condition="$info.director_id eq $sql.user_id" }selected{/if}>{$sql.name}
												 </option> {/if} {if condition="$info.director_id==0" } <option value="{$sql.user_id}" {if condition="session('admin.userid') eq $sql.user_id"
												 }selected{/if}>{$sql.name} </option> {/if} {/sql} </select> </div> </div> <div class="form-group layui-form">
													<label class="col-sm-2 control-label">介绍人：</label>
													<div class="col-sm-9">
														<?php if(!isset($info['is_introducer'])){ $info['is_introducer'] = 2; } ?>
														<input lay-filter="is_introducer" name="is_introducer" value="1" type="radio" {if condition="$info.is_introducer eq '1'"
														 }checked{/if} title="是">
														<input lay-filter="is_introducer" name="is_introducer" value="2" type="radio" {if condition="$info.is_introducer eq '2'"
														 }checked{/if} title="否">
													</div>
										</div>
										<div class="form-group layui-form introducer" {if condition="$info.is_introducer neq '1'" }style="display: none;"
										 {/if}> <label class="col-sm-2 control-label">介绍人：</label>
											<div class="col-sm-9">
												<div class="layui-form-select ySearchSelect y2">
													<div class="layui-input">{$info.introducer}</div>
													<input name="introducer_id" class="form-control layui-input-key" id="introducer_id" type="hidden" value="{$info.introducer_id}">
													<input name="introducer" class="form-control layui-input-val" id="introducer" type="hidden" value="{$info.introducer}">
													<i class="layui-edge"></i>
													<ul>
														{sql query="select id,name from cd_introducer"}
														<li value="{$sql.id}" class="on">{$sql.name}</li>
														{/sql}
														<p>无匹配项</p>
													</ul>
												</div>
											</div>

											<!--					<div class="col-sm-9">-->
											<!--						<select lay-ignore name="introducer_id" class="form-control" id="introducer_id">-->
											<!--							<option value="0">请选择</option>-->
											<!--							{sql query="select id,name from cd_introducer"}-->
											<!--							<option value="{$sql.id}" {if condition="$info.introducer_id eq $sql.id"}selected{/if}>{$sql.name}</option>-->
											<!--							{/sql}-->
											<!--						</select>-->
											<!--					</div>-->

										</div>

										<div class="form-group layui-form">
											<label class="col-sm-2 control-label">代管项及改名：</label>
											<div class="col-sm-9">
												银行本：
												<?php if(!isset($info['is_yhb_dg'])){ $info['is_yhb_dg'] = 1; } ?>
												<input name="is_yhb_dg" value="1" type="radio" {if condition="$info.is_yhb_dg eq '1'" }checked{/if} title="是">
												<input name="is_yhb_dg" value="2" type="radio" {if condition="$info.is_yhb_dg eq '2'" }checked{/if} title="否">
												护照：
												<?php if(!isset($info['is_hz_dg'])){ $info['is_hz_dg'] = 2; } ?>
												<input name="is_hz_dg" value="1" type="radio" {if condition="$info.is_hz_dg eq '1'" }checked{/if} title="是">
												<input name="is_hz_dg" value="2" type="radio" {if condition="$info.is_hz_dg eq '2'" }checked{/if} title="否">
												居留证：
												<?php if(!isset($info['is_jlzdg'])){ $info['is_jlzdg'] = 2; } ?>
												<input name="is_jlzdg" value="1" type="radio" {if condition="$info.is_jlzdg eq '1'" }checked{/if} title="是">
												<input name="is_jlzdg" value="2" type="radio" {if condition="$info.is_jlzdg eq '2'" }checked{/if} title="否">
												改名：
												<?php if(!isset($info['is_rename'])){ $info['is_rename'] = 2; } ?>
												<input name="is_rename" value="1" type="radio" {if condition="$info.is_rename eq '1'" }checked{/if} title="是">
												<input name="is_rename" value="2" type="radio" {if condition="$info.is_rename eq '2'" }checked{/if} title="否">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">客户电话：</label>
											<div class="col-sm-9">
												<input type="text" id="mobile" value="{$info.mobile}" name="mobile" class="form-control" placeholder="请输入电话">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">身份证号：</label>
											<div class="col-sm-9">
												<input type="text" id="id_card" value="{$info.id_card}" name="id_card" class="form-control {if condition="
												 $info.id==0"}id_card{/if}" {if condition="$info.id > 0" } readonly {/if} placeholder="请输入身份证号">
											</div>
										</div>

										<div class="form-group">
											<label class="col-sm-2 control-label">身份证：</label>
											<div class="layui-inline col-sm-9">
												背面 BORA
												<div class="layui-input-inline" style="width: 200px;">
													<input type="text" id="id_card_upside_no" value="{$info.id_card_upside_no}" name="id_card_upside_no" class="form-control"
													 placeholder="请输入身份证反面数字BORA-9.2-02-2560">
												</div>
												背面 JT
												<div class="layui-input-inline" style="width: 200px;">
													<input type="text" id="id_card_upside_two" value="{$info.id_card_upside_two}" name="id_card_upside_two"
													 class="form-control" placeholder="请输入身份证反面数字ME0-1111974-26">
												</div>

											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">姓名宗教：</label>
											<div class="layui-inline col-sm-9">
												名
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="first_name" value="{$info.first_name}" name="first_name" class="form-control"
													 placeholder="请输入first_name">
												</div>
												姓
												<div class="layui-input-inline" style="width: 200px;">
													<input type="text" id="last_name" value="{$info.last_name}" name="last_name" class="form-control"
													 placeholder="请输入last_name">
												</div>
												宗教
												<div class="layui-input-inline" style="width: 200px;">
													<input type="text" id="religion" value="{if condition=" $info.religion eq ''"}佛教{else}{$info.religion}{/if}"
													 name="last_name" class="form-control" placeholder="请输入宗教">
												</div>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">住址：</label>
											<div class="col-sm-9">
												<input type="text" id="addr" value="{$info.addr}" name="addr" class="form-control" placeholder="请输入住址">
											</div>
										</div>

										<div class="form-group">
											<label class="col-sm-2 control-label">在台工作：</label>
											<div class="layui-inline col-sm-9">
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="work_year" value="{$info.work_year}" name="work_year" class="form-control"
													 placeholder="请输入在台工作年">
												</div>
												年
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="work_month" value="{$info.work_month}" name="work_month" class="form-control"
													 placeholder="请输入在台工作月">
												</div>
												月
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="work_times" value="{$info.work_times}" name="work_times" class="form-control"
													 placeholder="请输入次数">
												</div>
												次
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">日期：</label>
											<div class="layui-inline col-sm-9">
												出生日期
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="birth_day" value="{if condition=" $info.birth_day neq ''"}{$info.birth_day|date="
													 Y-m-d"}{/if}" name="birth_day" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
													 placeholder="请输入身份证出生日">

												</div>
												身份证有效期
												<div class="layui-input-inline" style="width: 100px;">
													<input type="text" id="expiry_date" value="{if condition=" $info.expiry_date neq ''"}{$info.expiry_date|date="
													 Y-m-d"}{/if}" name="expiry_date" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
													 placeholder="请输入身份证有效期">
												</div>
											</div>
										</div>

										<div class="form-group layui-form">
											<label class="col-sm-2 control-label">身份证图：</label>
											<div class="col-sm-6">
												<input type="text" id="idcardimg" value="{$info.idcardimg}" name="idcardimg" class="form-control"
												 placeholder="">
												<div class="idcardimg pic_list"></div>
												<div style="clear:both"></div>
												<span class="help-block m-b-none idcardimg_process"></span>
											</div>
											<div class="col-sm-1" style="padding-left:0; padding-right:0">
												<span id="idcardimg_upload"></span>
											</div>
										</div>
										<div class="form-group layui-form">
											<label class="col-sm-2 control-label">身份证图反面：</label>
											<div class="col-sm-6">
												<input type="text" id="idcardimgel" value="{$info.idcardimgel}" name="idcardimgel" class="form-control"
												 placeholder="">
												<div class="idcardimgel pic_list"></div>
												<div style="clear:both"></div>
												<span class="help-block m-b-none idcardimgel_process"></span>
											</div>
											<div class="col-sm-1" style="padding-left:0; padding-right:0">
												<span id="idcardimgel_upload"></span>
											</div>
										</div>
										<div class="form-group layui-form">
											<label class="col-sm-2 control-label">银行本图：</label>
											<div class="col-sm-6">
												<input type="text" id="bankimg" value="{$info.bankimg}" name="bankimg" class="form-control" placeholder="">
												<div class="bankimg pic_list"></div>
												<div style="clear:both"></div>
												<span class="help-block m-b-none bankimg_process"></span>
											</div>
											<div class="col-sm-1" style="padding-left:0; padding-right:0">
												<span id="bankimg_upload"></span>
											</div>
										</div>
										<div class="form-group layui-form">
											<label class="col-sm-2 control-label">护照及其他：</label>
											<div class="col-sm-6">
												<input type="text" id="wjbhzimg" value="{$info.wjbhzimg}" name="wjbhzimg" class="form-control" placeholder="">
												<div class="wjbhzimg pic_list"></div>
												<div style="clear:both"></div>
												<span class="help-block m-b-none wjbhzimg_process"></span>
											</div>
											<div class="col-sm-1" style="padding-left:0; padding-right:0">
												<span id="wjbhzimg_upload"></span>
											</div>
										</div>
									</div>

								</div>
							</div>
							<div class="layui-tab-item">
								<div class="col-sm-12">
									<div class="personInfo">
										<form id="personForm">
											<div class="passport_title">泰国外交部</div>
											<div>使用者:<input type="text" id="user_2_name" style="border: none;" name="user_2_name"><span class="person_date">日期:<input
													 id="user_2_day" style="border: none;" type="text" id="user_2_day" placeholder="选择时间" name="user_2_day"></span><button
												 type="button" class="addBtn" id="addColumn">新增</button></div>
										</form>
									</div>

									<div class="passport_form">
										<div class="passport_form_header clearfix">
											<div class="col-1 column">
												<p>序号</p>
											</div>
											<div class="col-2 column">
												<p>護照號碼</p>
												<p>姓名 (泰文)</p>
												<p>姓名 (英文)</p>
											</div>
											<div class="col-3 column">
												<p>國民身份證字號</p>
											</div>
											<div class="col-4 column">
												<p>出生日期</p>
												<p>性別</p>
												<p>微片</p>
											</div>
											<div class="col-5 column">
												<p>核發日期</p>
												<p>-類別</p>
												<p>-狀態</p>
											</div>
											<div class="col-6 column">
												<p>截止日期</p>
											</div>
											<div class="col-7 column">
												<p>操作</p>
											</div>
										</div>
										<div class="passport_form_body clearfix" id="formAdd">

											<!--<div class="col-item clearfix">
											<form>
												<div class="col-1 column">
													<p><input type="text" name="1" value="2" readonly="readonly" /></p>
												</div>
												<div class="col-2 column">
													<p><input type="text" name="2" value="L109136" /></p>
													<p><input type="text" name="3" value="WICHAI BAONAK" /></p>
													<p><input type="text" name="4" value="WICHAI BAONAK" /></p>
												</div>
												<div class="col-3 column">
													<p><input type="text" name="5" value="3-4404-00405-49-1" /></p>
												</div>
												<div class="col-4 column">
													<p><input type="text" name="6" value="21/12/1957" /></p>
													<p><input type="text" name="7" value="男性" /></p>
													<p><input type="text" name="8" value="M934 0197 00" /></p>
												</div>
												<div class="col-5 column">
													<p><input type="text" name="9" value="09/09/1991" /></p>
													<p><input type="text" name="10" value="-5 – 普通" /></p>
													<p><input type="text" name="11" value="C – 取消" /></p>
												</div>
												<div class="col-6 column">
													<p><input type="text" name="12" value="22/06/1994" /></p>
												</div>
												<div class="col-7 column" onclick="onDelete(this)">
													<p>删除</p>
												</div>
											</form>
										</div>-->
										</div>

									</div>

								</div>
							</div>
						</div>
					</div>
				</div>


			</div>
		</div>
		<div class="hr-line-dashed"></div>
		<div class="row btn-group-m-t">
			<div class="col-sm-9 col-sm-offset-1">
				<button type="button" class="btn btn-primary" onclick="{if condition=" $info.id neq ''"}CodeInfoDlg.update(){else/}CodeInfoDlg.add(){/if}"
				 id="ensure">
					<i class="fa fa-check"></i>&nbsp;确认提交
				</button>
				<button type="button" class="btn btn-primary" id="passCard" style="display: none;">
					<i class="fa fa-check"></i>&nbsp;确认提交
				</button>
				<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
					<i class="fa fa-eraser"></i>&nbsp;取消
				</button>
			</div>
		</div>
	</div>
	<style>
		/*带搜索的下拉框 - 开始*/
	.ySearchSelect{
		height: 32px;
		position: relative;
	}
	.ySearchSelect i.layui-edge{
		z-index: 1;
	}
	.ySearchSelect i.select{
		-webkit-transform: rotate(180deg);
		-o-transform: rotate(180deg);
		-moz--transform: rotate(180deg);
		transform: rotate(180deg);
		margin-top: -8px;
	}
	.ySearchSelect .layui-input{
		line-height: 32px;
		position: relative;
		z-index: 1;
	}
	.ySearchSelect .input-text{
		line-height: 32px;
		position: absolute;
		top: 31px;
		left: 1px;
		z-index: 3;
		display: none;
		background-color: #FFF;
	}
	.ySearchSelect .input-text input{
		width: 96%;
		margin-left: 2%;
		height: 36px;
		line-height: 36px;
	}
	.ySearchSelect .input-text .iconfont{
		line-height: 36px;
		color: #999;
		position: absolute;
		top: 0px;
		right: 4%;
		z-index: 2;
	}
	.ySearchSelect ul{
		display: none;
		width: 100%;
		max-height: 228px;
		position: relative;
		top: 0px;
		z-index: 2;
		background-color: #fff;
		border: 1px solid #d2d2d2;
		border-top: 0;
		margin-top: -1px;
		padding: 5px 0;
		padding-top: 36px;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
	}
	.ySearchSelect ul li{
		width: 100%;
		height: 36px;
		line-height: 36px;
		padding: 0 10px;
		cursor: pointer;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.ySearchSelect ul li.active{
		background-color: #009688 !important;
		color: #FFF;
	}
	.ySearchSelect ul p{
		width: 100%;
		height: 36px;
		line-height: 36px;
		text-align: center;
		padding: 0 10px;
		color: #999;
		cursor: pointer;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.ySearchSelect ul li.on{
		display: block;
	}
	.ySearchSelect ul li.hide{
		display: none;
	}
	.ySearchSelect ul li:hover{
		background-color: #f0f0f0;
	}
	/*带搜索的下拉框 - 结束*/
</style>

<link href='__PUBLIC__/static/css/viewer.css' rel='stylesheet'/>
<script src="__PUBLIC__/static/js/admin/record/Content.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/viewer.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/viewpic.js" charset="utf-8"></script>

<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<link rel='stylesheet' href='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.css'>
<script type='text/javascript' src='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.min.js'></script>
<link href='__PUBLIC__/static/js/plugins/chosen/chosen.min.css' rel='stylesheet'/>
<script src='__PUBLIC__/static/js/plugins/chosen/chosen.jquery.js'></script>
<script src="__PUBLIC__/static/js/pinyin.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/ySearchSelect.js" charset="utf-8"></script>
<script>
layui.config({dir: '__PUBLIC__/static/js/plugins/layui/'});
	layui.use(['form'], function () {
	form = layui.form();
	var $ = layui.jquery;
		var idcard_info = {$info.idcard_info?$info.idcard_info:'null'};
		var passport_info = {$info.passport_info?$info.passport_info:'null'};
		console.log(idcard_info);
	// form.on('checkbox(checkpic)',function(data){
	// 	if(data.elem.checked){
	// 		var ajax = new $ax(Feng.ctxPath + "/Record.Customer/getThumbPic", function (data) {
	// 			if(data.status == '00'){
	// 				$("#pic").val(data.imgurl);

	<script src="__PUBLIC__/static/js/admin/record/Content.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
	<link href='__PUBLIC__/static/css/viewer.css' rel='stylesheet' />
	<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
	<script src="__PUBLIC__/static/js/viewer.js" charset="utf-8"></script>
	<script src="__PUBLIC__/static/js/viewpic.js" charset="utf-8"></script>

	<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
	<link rel='stylesheet' href='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.css'>
	<script type='text/javascript' src='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.min.js'></script>
	<link href='__PUBLIC__/static/js/plugins/chosen/chosen.min.css' rel='stylesheet' />
	<script src='__PUBLIC__/static/js/plugins/chosen/chosen.jquery.js'></script>
	<script src="__PUBLIC__/static/js/pinyin.js" charset="utf-8"></script>
	<script src="__PUBLIC__/static/js/ySearchSelect.js" charset="utf-8"></script>
	<script>
		// console.log($info+"!!!1")

		// console.log($info);
			var idcard_info = {$info.idcard_info ? $info.idcard_info : 'null'};
			var passport_info = {$info.passport_info ? $info.passport_info : 'null'};
			console.log(JSON.stringify(passport_info) + "!!");
			// console.log(JSON.stringify(idcard_info) + "!!");


		if(passport_info != null ){

				let Arr = passport_info.arr;

				if(JSON.stringify(Arr[0]) != "{}"){
					let htmlstr="";
				for(let j=0;j<Arr.length;j++){
					 htmlstr += `<div class="col-item clearfix">
						<form>
							<div class="col-1 column">
								<p><input type="text" value="${j+1}" /></p>
							</div>
							<div class="col-2 column">
								<p><input type="text" name="user_2_number"  value=${Arr[j].user_2_number} placeholder="护照号码1"/></p>
								<p><input type="text" name="user_2_th" value=${Arr[j].user_2_th} placeholder="姓名 (泰文)"/></p>
								<p><input type="text" name="user_2_en" value=${Arr[j].user_2_en} placeholder="姓名 (英文)"/></p>
							</div>
							<div class="col-3 column">
								<p><input type="text" name="user_2_codeNum" value=${Arr[j].user_2_codeNum} placeholder="國民身份證字號"/></p>
							</div>
							<div class="col-4 column">
								<p><input type="text" name="user_2_birthDay"   value=${Arr[j].user_2_birthDay} placeholder="出生日期"/></p>
								<p><input type="text" name="user_2_sex" value=${Arr[j].user_2_sex} placeholder="性别"/></p>
								<p><input type="text" name="user_2_microfilm" value=${Arr[j].user_2_microfilm} placeholder="微片"/></p>
							</div>
							<div class="col-5 column">
								<p><input type="text"  name="user_approveDay"  value=${Arr[j].user_approveDay} placeholder="核發日期"/></p>
								<p><input type="text" name="user_2_kind" value=${Arr[j].user_2_kind} placeholder="-類別"/></p>
								<p><input type="text" name="user_2_statu" value=${Arr[j].user_2_statu} placeholder="–状态"/></p>
							</div>
							<div class="col-6 column">
								<p><input type="text"  name="user_2_endDate"  value=${Arr[j].user_2_endDate}   placeholder="截止日期"/></p>
							</div>
							<div class="col-7 column hook-delete" >
								<p >删除</p>
							</div>
						</form>
						</div>`;

				}
				$("#formAdd").html(htmlstr);
				// initTime1();
				}

				let {arr,...rest} = passport_info;
				for(let j in rest){
					$("input[name="+j+"]").val(rest[j]);
				}

		}

		// 判断渲染那个
		$('.layui-tab-title li').on('click', function() {
			let a = $(this).attr('lay-id');
			if (a == 1) {
				$("#ensure").show();
				$("#passCard").hide()
			} else {
				$("#ensure").hide();
				$("#passCard").show()
			}
		})


		layui.config({
			dir: '__PUBLIC__/static/js/plugins/layui/'
		});
		layui.use(['form'], function() {
			form = layui.form();
			var $ = layui.jquery;

			form.on('checkbox(checkpic)', function(data) {
				if (data.elem.checked) {
					var ajax = new $ax(Feng.ctxPath + "/Record.Customer/getThumbPic", function(data) {
						if (data.status == '00') {
							$("#pic").val(data.imgurl);
						}
					});
					ajax.start();
				}
			});
			form.on('radio(is_introducer)', function(data) {
				console.log(data.value); //被点击的radio的value值
				if (data.value != 1) {
					$(".introducer").hide();
					//$(".introducer_mobile").hide();
					//$("#jsrbankimgdiv").hide();
				} else {
					$(".introducer").show();
					//$(".introducer_mobile").show();
					//$("#jsrbankimgdiv").show();
				}
			});

			$(".id_card").blur(function() {
				var id_card = $.trim($(this).val());
				var html = '<small class="help-block" id="id_card_exist" style="display: none;">该客户已经存在</small>';
				$(this).parent().append(html);
				if (id_card != '') {
					$.post("{:url('admin/Record.Customer/checkIdCard')}", {
						id_card: id_card
					}, function(result) {
						if (result.status != '00') {
							$("#id_card_exist").show();
							$("#id_card").next().removeClass('glyphicon-ok').addClass('glyphicon-remove');
							$("#id_card").parent().parent().removeClass('has-success').addClass('has-error');
							// Feng.info('该客户已存在');
						}
					});
				}
			});

			$(".id_card").keyup(function() {
				var flag = false;
				$(this).nextAll('small').not('#id_card_exist').each(function() {
					if ($(this).is(':visible')) {
						flag = true;
					}
				})
				if (flag) {
					$("#id_card_exist").hide();
				}
			});

		});
		layui.use('element', function() {
			var element = layui.element();
			element.on('tab(test)', function(elem) {});
		});



		$('#addColumn').click(function() {
			//		已有元素的length
			let i = passport_info == null ? 1 : passport_info.arr.length;
			const el = $('#formAdd')[0];
			setTimeout(function() {
				$('#formAdd').scrollTop($('#formAdd')[0].scrollHeight + 200);
			}, 0)

			let htmlstr =
				`<div class="col-item clearfix"><form>
							<div class="col-1 column">
								<p><input type="text" value="${i}" /></p>
							</div>
							<div class="col-2 column">
								<p><input type="text" name="user_2_number" placeholder="护照号码"/></p>
								<p><input type="text" name="user_2_th" placeholder="姓名 (泰文)"/></p>
								<p><input type="text" name="user_2_en" placeholder="姓名 (英文)"/></p>
							</div>
							<div class="col-3 column">
								<p><input type="text" name="user_2_codeNum" placeholder="國民身份證字號"/></p>
							</div>
							<div class="col-4 column">
								<p><input type="text"  name="user_2_birthDay"  placeholder="出生日期"/></p>
								<p><input type="text" name="user_2_sex" placeholder="性别"/></p>
								<p><input type="text" name="user_2_microfilm" placeholder="微片"/></p>
							</div>
							<div class="col-5 column">
								<p><input type="text" name="user_approveDay"  placeholder="核發日期"/></p>
								<p><input type="text" name="user_2_kind" placeholder="-類別"/></p>
								<p><input type="text" name="user_2_statu" placeholder="–状态"/></p>
							</div>
							<div class="col-6 column">
								<p><input type="text" name="user_2_endDate" placeholder="截止日期"/></p>
							</div>
							<div class="col-7 column hook-delete" >
								<p >删除</p>
							</div></form></div>`;
			$("#formAdd").append(htmlstr);
			// initTime1();
			$(".hook-delete").each(function() {
				$(this).click(function() {
					onDelete(this);
				})

			})

			setTimeout(function() {
				let a = $("#formAdd").find('.col-item').length;
				$(".col-item .col-1 input").each(function(index, element) {
					$(this).val(index + 1)
				});
			}, 0)

		})

		function onDelete(dom) {
			$(dom).parent().parent().remove();
			let a = $("#formAdd").find('.col-item').length;
			$(".col-item .col-1 input").each(function(index, element) {
				$(this).val(index + 1)
			});

		}

		// 提交
		$("#passCard").click(function(){
			$.fn.serializeObject = function() {
				var o = {};
				var a = this.serializeArray();
				$.each(a, function() {
					if(o[this.name]) {
						if(!o[this.name].push) {
							o[this.name] = [o[this.name]];
						}
						o[this.name].push(this.value || '');
					} else {
						o[this.name] = this.value || '';
					}
				});
				return o;
			};

			let size = $(".passport_form_body").children('.col-item').length;
			if(size <1){
				layer.alert('至少保存一条护照信息！');
				return;
			}
			let arr = [];
			$(".passport_form_body .col-item").each(function(item, element) {
				console.log($(this).children('form')[0]);
				let item_form = $(this).children('form').serializeObject();
				console.log(item_form);
				arr.push(item_form);
			});

			var id = $('#id').val();
			let type = 2;//1是身份证 2是护照
			var passport_info_new={};
			if(!passport_info && typeof(passport_info)!='undefined' && passport_info!=0){
				passport_info_new = {
					arr:[],
					user_2_signNum1: " ",
					proveData_time: " ",
					user_2_signNum2: " ",
					user_2_person1: " ",
					user_2_person2: "",
					user_2_person3: "",
					user_2_date1: "",
					personApplytion: "",
					lastData_time: "",
					user_2_name:$('#user_2_name').val(),
					user_2_day: $('#user_2_day').val()
				};
			}
			function isEmptyObject(a) {
			    var b;
			    for (b in a) {
			        return !1;
			    }
			    return !0
			}
			if(!isEmptyObject(passport_info_new)){
				passport_info_new['arr'] = arr
			}else{
				passport_info['arr'] = arr;
			}


			Feng.confirm("是否保存？", function () {
				var ajax = new $ax(Feng.ctxPath + "/stepthree/update?type=" +type +"&id=" +id, function (data) {
					if ('00' === data.status) {
						Feng.success(data.msg);
						//CodeGoods.table.refresh();
					} else {
						Feng.error(data.msg);
					}
				});
				passport_info = passport_info?passport_info:passport_info_new;
				console.log(JSON.stringify(passport_info));
				ajax.setData(JSON.stringify(passport_info));
				ajax.start();
			});

		})






		//多图上传
		var images = $("#idcardimg").val();
		var images1 = $("#idcardimgel").val();
		var images2 = $("#bankimg").val();
		var images3 = $("#wjbhzimg").val();
		//var images4 = $("#jsrbankimg").val();
		default_value = getDefaultVal(images);
		default_value1 = getDefaultVal(images1);
		default_value2 = getDefaultVal(images2);
		default_value3 = getDefaultVal(images3);
		//default_value4 = getDefaultVal(images4);
		uploader('bankimg_upload', 'bankimg', 'image', true, default_value2, '{:url("admin/Upload/uploadImages")}');
		uploader('wjbhzimg_upload', 'wjbhzimg', 'image', true, default_value3, '{:url("admin/Upload/uploadImages")}');
		uploader('idcardimg_upload', 'idcardimg', 'image', true, default_value, '{:url("admin/Upload/uploadImages")}');
		uploader('idcardimgel_upload', 'idcardimgel', 'image', true, default_value1, '{:url("admin/Upload/uploadImages")}');
		//uploader('jsrbankimg_upload','jsrbankimg','image',true,default_value4,'{:url("admin/Upload/uploadImages")}');
		function getDefaultVal(images) {
			var default_value;
			var images = images.substr(0, images.length - 1);

			if (images !== '') {
				var images_value;
				if (images.indexOf("|") == -1) {
					images_value = '["' + images + '"]';
				} else {
					images_value = JSON.stringify(images.split("|"));
				}
				default_value = images_value;
			} else {
				default_value = '';
			}
			return default_value;
		}

		$(function() {
			layui.config({
				dir: '__PUBLIC__/static/js/plugins/layui/'
			});
			layui.use(['layer', 'form'], function() {
				window.layer = layui.layer;
				form = layui.form();
				form.render();
			});
			$('.filelist').viewer();
			$(".y2").ySearchSelect(); //调用自定义 高亮插件




		})
	</script>


	{/block}
